/*
 * Copyright 2009 Max Kugland
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
package org.splink.deepsplink.page {
	import org.splink.deepsplink.navigation.command.INavigationCommand;
	import org.splink.deepsplink.page.state.PageState;
	import org.splink.library.distributor.IDistributor;
	import org.splink.library.tree.Tree;

	/**
	 * <code>IPageInternal</code> is the frameworks internal representation of
	 * a page.
	 * 
	 * @author Max Kugland
	 */
	public interface IPageInternal extends IPageSupplier, IDistributor {
		
		/**
		 * @param page the <code>IPage</code> implementation upon which 
		 * <code>IPageInternal</code> operates
		 */
		function setPage(p : IPage) : void
		 
		/**
		 * Sets the title of the page
		 * 
		 * @param title the title of the page
		 */
		function setTitle(t : String) : void;

		/**
		 * Changes the state of the page. 
		 * 
		 * @see org.splink.deepsplink.page.PageState
		 */
		function setState(s : PageState) : void;

		/**
		 * Injects an array of <code>PageParameter</code> instances into the page. 
		 * This happens 
		 * 1) before the page is initialized 
		 * 2) if the page parameters change.
		 * 
		 * @see org.splink.deepsplink.page.params.PageParameter
		 * 
		 * @param params an array of <code>PageParameter</code> instances
		 */
		function setParams(p : Array) : void;

		/**
		 * Sets the <code>Tree</code> instance which holds the internal representation
		 * of the page structure.
		 * 
		 * @param tree the tree
		 */
		function setTree(t : Tree) : void;

		/**
		 * Sets an <code>INavigationCommand</code> instance, which is used for 
		 * page navigation. 
		 * 
		 * @param navigationCmd an <code>INavigationCommand</code> instance
		 * @see org.splink.deepsplink.navigation.INavigationCommand
		 */
		function setNavigationCommand(navigationCmd : INavigationCommand) : void;

		/**
		 * Initializes the page. Upon completion a <code>PageEvent.INITIALIZED</code> is 
		 * distributed. During initialization the state of the page is 
		 * <code>PageStates.INITIALIZING_STATE</code>
		 * 
		 * Note that the page will not be part of the displaylist until <code>initialize</code>
		 * is invoked.
		 */
		function initialize() : void;

		/**
		 * Shows the page, upon completion a <code>PageEvent.SHOWN</code> is  distributed. 
		 * During showing the state of the page is <code>PageStates.SHOWING_STATE</code> 
		 */
		function show() : void;

		/**
		 * Hides the page, upon completion a <code>PageEvent.HIDDEN</code> is distributed. 
		 * During hiding the state of the page is <code>PageStates.HIDING_STATE</code> 
		 */
		function hide() : void;
	}
}
